
const TOKEN_KEY = 'rbac_token';
const USERNAME_KEY = 'rbac_username';
const USER_ID_KEY = 'rbac_user_id';
const ROLE_IDS_KEY = 'rbac_role_ids';

export function setToken(token) {
  window.localStorage.setItem(TOKEN_KEY,token);
}

export function getToken() {
  return window.localStorage.getItem(TOKEN_KEY);
}

export function removeToken() {
  window.localStorage.removeItem(TOKEN_KEY)
}


export function setUsername(username) {
  window.localStorage.setItem(USERNAME_KEY,username);
}

export function getUsername() {
  return window.localStorage.getItem(USERNAME_KEY)
}

export function removeUsername() {
  window.localStorage.removeItem(USERNAME_KEY)
}

export function setUserId(userId) {
  window.localStorage.setItem(USER_ID_KEY,userId);
}

export function getUserId() {
  return window.localStorage.getItem(USER_ID_KEY)
}

export function removeUserId() {
  return window.localStorage.removeItem(USER_ID_KEY)
}

export function setRoleIds(roleIds) {
  window.localStorage.setItem(ROLE_IDS_KEY,roleIds.join('-'));
}

export function getRoleIds() {
  return window.localStorage.getItem(ROLE_IDS_KEY).split('-');
}

export function removeRoleIds() {
  window.localStorage.removeItem(ROLE_IDS_KEY);
}
